package com.tanhua.server.service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.tanhua.dubbo.server.api.Test1Api;
import com.tanhua.dubbo.server.pojo.Test1;
import com.tanhua.server.pojo.User;
import com.tanhua.server.utils.UserThreadLocal;
import org.springframework.stereotype.Service;

@Service
public class Test1Service {
    @Reference(version = "1.0.0")
    private Test1Api test1Api;
    public Boolean update(Boolean likeOpen, Boolean commentOpen, Boolean announcementOpen) {
        User user = UserThreadLocal.get();
        Boolean save = this.test1Api.save(user.getId(), likeOpen, commentOpen, announcementOpen);
        if (save){
            return true;
        }else{
            return false;
        }
    }


    public Test1 find() {
        User user = UserThreadLocal.get();

        Test1 test1 = this.test1Api.find(user.getId());
        return test1;
    }
}
